Hayes(r) Microcomputer Products, Inc. LANstep(r) Technical Note "Creating a DOS Startup Script for a LANstep Workstation" Number LS-1 September 1991 Summary: This Technical Note explains how a Super_User can create a startup script for a LANstep Workstation user that bypasses the LANstep "office" screen and automatically: * loads a user's most frequently used or menuing application immediately after log-in, or * starts a user in DOS at a mapped drive location. This Technical Note is applicable for LANstep version 1.0x. Some Questions Answered This section outlines in brief what can be accomplished with a DOS startup script, why it might be useful, who should do it, and, the basics of how it is done. Further sections go into detail on each part of the process Why A LANstep Workstation boots (starts up) using LANstep as the underlying operating system, and then a user must manually select a DOS program for use. This script automates those steps. This is helpful on systems where menu-type programs are in use and need to be automatically executed after log-in. Who Since this procedure involves entering the Support room, only a Super_User who is familiar with user setups and commands such as NETUSE should attempt to create a startup script. Keep in mind that startup scripts must be created for each user that needs one. How First, you'll create a single line start-up script that loads DOS after a valid login. When DOS loads, (typically from the E: drive) AUTOEXEC.BAT (the same for all users) runs, and moves to a user's personal directory (usually G: drive). From there, AUTOEXEC.BAT ends by executing a second batch file (START.BAT) located in an individual user's personal directory. START.BAT uses the NETUSE command and assigns the F: drive to the location where a user's frequently used program is kept. At that point, a user need only enter WMSTART to execute a batch file to load the program. Cautions The Super_User should take care when using the Browser, since accidental erasure of system files would require re-installing the system, and possibly reformatting the NSS hard drive. About Bill "Bill" is a fictional LANstep user. In our example, we're going to create a DOS startup script for him that automatically loads DOS after a valid login, then leaves Bill at his personal G: drive DOS prompt. Bill's USERID is BILL. Creating a Login Script Use these steps to create a login script for automatically loading DOS for Bill. Be sure you can login as Super_User. Step 1: Login as Super_User at the NSS, then move to the Support Room. Step 2: Select the Browse Hard Disk 0 icon and press Enter, then select System and press Enter. Step 3: Select userids and press Enter, then select BILL and press Enter. Step 4: Select login and press F2 to display the startup script; since there is no script, the screen will be blank. Press F5 to edit, then enter the following line: !pcdos -0 {} {} {} */DOS/BOOT {} #user/DOS {} E: Remember, LANstep is case sensitive, so be sure you type the line as shown. This script command tells LANstep to automatically run DOS immediately after the specified user (Bill) has completed a valid login. Here's a breakdown of each component of the command: Element Description !pcdos starts the activity called "pcdos" -0 uses all available "DOS" memory (lower 640K); this is a zero, not the letter "O" {} Uses default printer for LPT1 {} Uses default printer for LPT2 {} Uses default printer for LPT3 */DOS/BOOT Sets path for drive E: to BOOT on the NSS {} Sets Drive F: to be unmapped but still available #user/DOS Sets G: to users personal DOS files {} Drive H: is reserved for system use and is not mapped E: Selects which drive is the BOOT drive, i.e, where DOS is loaded Step 5: Once the command is typed in, press F5 to save. Testing The Script Use this procedure when editing the script to test it instantly: Step 1: With the cursor on the script command line, press Control-Space, then Control-Space again. Step 2: Press F2:START and the script is automatically executed. This is an excellent way to test check the script's accuracy. If you get an error message at the top of the screen, such as "COMMAND," press Control-Escape. The cursor appears at the top of the screen; move it to the word COMMAND and press Enter. You'll see an explanation of the message. Recheck your typing. Remember, the command line is case sensitive. Note that during this test, G: will be mapped to the Super_User's personal files, not Bill's. Step 3: When at DOS prompt, type DOSEXIT and press Enter to go back to the startup script. Modifying AUTOEXEC.BAT Each time DOS is loaded by a user, the common AUTOEXEC.BAT file (located on drive E:)is executed. While everyone uses the same AUTOEXEC.BAT, you can create an individual batch file for Bill which maps the F: drive to the location of his most frequently used application. When there, Bill needs to only enter the WMSTART command to execute the WMSTART.BAT batch file and load the application. Use these steps to modify the common (on drive E:) AUTOEXEC.BAT to echo a reminder, then run a second batch file (START.BAT, on Bill's drive G:) START.BAT only contains two lines, and uses the NETUSE command to assign drive F: to the directory where Bill's application is kept. Step 1: From the previous steps, press Escape to leave this screen, then press F3:CLIMB three times. This will take you to the top menu of the Browser. Step 2: Select DOS and press Enter. Select BOOT and press Enter. Step 3: Select AUTOEXEC.BAT and press F2:VIEW. Press F5:EDIT, and go to the last line of the file. Step 4: Type in the following 2 lines, pressing Enter after each one: ECHO Type WMSTART to start the application. START.BAT The ECHO line displays "Type WMSTART..." to remind Bill to type in the standard WMSTART command to execute the batch file used to load his frequently used application. Step 5: Press F5:SAVE key, then press Escape. You should now be at the screen that is displaying the contents of the E: drive, with all of the DOS files. Finding an Application's Location and Creating START.BAT START.BAT is a batch file that uses the NETUSE command to map drive F: to the directory of Bill's most frequently used application. You should create a START.BAT for every user who wants this mapping done. To do this, first determine the directory location for each user's most-used application, then create a START.BAT batch file (on the user's drive G:) for each user. Note: Keep in mind that an individual user's START.BAT can only map F: to a single directory, so that directory should be the location of the application we want to start automatically for the user. Finding an Application's Location Use this procedure to locate the directory on the NSS where a loaded application is kept. You'll use this information to map that directory as the F: drive for a specific user. Step 1: From the previous steps, press F3:CLIMB, then select installed_apps. Press F2:VIEW. This will display all of the installed applications and their respective directories. For example, suppose the assisted INSTALL program installed Smartcom Exec(r); one of the lines would read: Smartcom Exec Version 2.x|SCMEXC2X Step 2: If you have installed many applications, you may need to scroll through the list by pressing the down cursor key. The first half of the line is the application description as it appears on the menu choice, and the part after the pipe ( | ) symbol is the actual directory that it is installed in. For the remainder of this example, let's assume Bill uses Microsoft Works frequently. When you select Microsoft Works 2.0 in the list, it appears as : Microsoft Works 2.0|MWORKS20 From this we know that the application resides in the directory MWORKS20. Manually installed applications appear like this: Automenu|MAN00001 Step 3: Find the other application(s) and accompanying directory(s), and write them down. You'll need to know these names and locations when you create START.BAT for other users. Step 4: Press Escape twice. Exit the Support Room, and enter the Management Console by selecting it and pressing Enter. Step 5: Choose DOS Application Management, and press Enter. Select Maintain Installed Applications, and press Enter. It does not matter which application you have highlighted. We will not be making any changes to the application itself. Step 6: Press F4:EDIT. Select Set Up Application For Users and press Enter. Highlight the USERID BILL, and press Enter. DOS loads, running AUTOEXEC.BAT, which tries to run the as yet non-existent START.BAT, so ignore the "Bad Command or Filename" message that DOS returns. When DOS starts, enter G: (this moves you to Bill's G: drive) and then press Enter. From this point, you'll be at the DOS prompt of Bill's G: drive. Creating START.BAT START.BAT can be configured three ways: * to map F: to an application's directory and leave the user at the DOS prompt * to map F: to an application's directory then run the WMSTART.BAT batch file to go ahead and load the application. * to just run a CLS command, so the "Bad command or file name" message is not seen. Step 1: From DOS, use the COPY from CONsole command to create START.BAT in Bill's G: drive: COPY CON START.BAT e The cursor drops to the next line (no DOS prompt is shown), and you should type these two lines, pressing Enter after each one: NETUSE F: */DOS/APPS/MWORKS20 F: Step 2: If you want START.BAT to stop here (leaving the user at DOS), press Control-Z then Enter and START.BAT will be written to disk. Otherwise, add this final line, then press Control-Z then Enter to create START.BAT on the disk. WMSTART Once you've created the file, DOS displays a message "1 File(s) copied." Remember to replace "MWORKS20" with the necessary directory name for other START.BAT files created for other users and their applications. Type DOSEXIT. When Bill next logs in, he is automatically taken to this directory. If you don't create a START.BAT file for other users, be sure they understand to ignore the Bad Command or Filename message they see when first starting DOS. This happens since AUTOEXEC.BAT tries to execute START.BAT in a user's directory, when no START.BAT is there. If this is a problem, go ahead and create a dummy START.BAT in each user's G:-mapped directory that contains a single CLS (clear screen) statement: COPY CON START.BAT CLS Then press Control-Z and Enter; START.BAT then just clears the screen and leaves the user at the G: prompt. Avoid "Bad command.." by Updating AUTOEXEC.BAT If you don't want a user to see the "Bad command or file name" error, you can further update AUTOEXEC.BAT to prevent this message from being seen. Here's a sample file: ECHO OFF PATH E:\;E:\WMCMDS USERDEV PRINTEND /T:20 NUL IF NOT EXIST F:WMSTART.BAT GOTO NEXT_STEP F: WMSTART :NEXT_STEP IF NOT EXIST G:START.BAT GOTO END G: START :END G: ECHO To return to your room, type DOSEXIT and press enter. The Default Login Script You can create a startup script that automatically runs an application, such as Automenu or Windows, each time a user logs in to the network. You can make this script work for all users, or just newly created ones. Here's how to do it: Step 1: From the NSS, login as Super_User; enter the Support room. Step 2: Start the Browse Hard Disk 0 Icon. Step 3: Choose system and press Enter; select userids and press Enter. Finally, select Super_User and press Enter. The next step is where you determine if the script is to be used for all users, or just ones created after the script is entered. --Step 4a: | To configure the script to run for *ALL* users, both | current and future, select system_defaults and press Enter. Pick | one--| | | -- Step 4b: To configure the script to run for users which are created *AFTER* the script is entered, select model_defaults and press Enter. Step 5: Select login and press Enter. Step 6: Press F5:EDIT. Step 7: Enter this line: !pcdos -0 {} {} {} */DOS/BOOT */DOS/APPS/MAN00001 #user/DOS {} E: Step 8: Press F5:SAVE. Step 9: Press Escape twice to exit to the Support Room The Automenu program will automatically be executed for the selected users after a valid login. Hayes and Smartcom Exec are registered trademarks, and LANstep is a trademark of Hayes Micrcomputer Products, Inc. Other trademarks appearing in this document are trademarks of the respective companies (C) 1991 Hayes Microcomputer Products, Inc.